<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Products Sheet</title>
</head>
<body>
<h2 align="center">Inventory Web Application</h2>
<p />
<table border="1" align="center">
	<tr>
		<th>#</th>
		<th>Name</th>
		<th>Description</th>
		<th>Quantity</th>
		<th />
	</tr>
	<c:set var="articleGeneralUrl" value="/inventory-app-1.0/articles" />
	<c:forEach var="article" items="${articles}" varStatus="status">
		<c:set var="articleFormId" value="article${status.index}" />
		<tr>
			<td>${status.count}</td>
			<td>${article.product.name}</td>
			<td>${article.product.description}</td>
			<td>${article.quantity}</td>

			<c:url var="editUrl" value="/articles/edit">
				<c:param name="id" value="${article.id}" />
			</c:url>

			<form id="${articleFormId}" action="${articleGeneralUrl}/delete"
				method="post">
			<input id="id" name="id" type="hidden" value="${article.id}" />
			</form>

			<td><a href='<c:out value="${editUrl}"/>'>Edit</a> <a
				href="javascript:document.forms['${articleFormId}'].submit();">Delete</a>
			</td>
		</tr>
	</c:forEach>
</table>
<p />
<p align="center"><a href="${articleGeneralUrl}/edit">Add new</a></p>
</body>
</html>